package com.xu.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    public static String stampToDate(long s){
        String res;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date = new Date(s);
        res = simpleDateFormat.format(date);
        return res;
    }

    public static boolean compareCurrentDate(long s){
        Date date = new Date();
        long currentTimeStamp = date.getTime();
        if (currentTimeStamp<s)
            return false;
        else
            return true;
    }

    public static String getCron(Date  date){
        String dateFormat="ss mm HH dd MM ? yyyy";
        SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
        String corn = null;
        if (date != null) {
            corn = sdf.format(date);
        }
        return corn;
    }
}
